<?php
##############################################
#
#   filecomment
# @ Time : 2017-9-10 - ����12:28:13
# @ Author : JiangYongWei <1085562810@qq.com>
# @ Encoding : UTF-8 language  : PHP
#
##############################################

class UserController extends Yaf\Controller_Abstract{
	
	public function init(){
		//$this->getView()->setScriptPath(APPLICATION_PATH."/template");
	}
	
	public function indexAction(){
		echo $a = $this->getRequest()->get('a');
		//http://www.yaf.com:8029/User/User/index/a/1/c/2/b/3
		//array(3) { ["a"]=> string(1) "1" ["c"]=> string(1) "2" ["b"]=> string(1) "3" }
		$param = $this->getRequest()->getParams();
		var_dump($param); 
		//$get = $this->getRequest()->getQuery('a', 'default value');
		$get = $this->getRequest()->getQuery();
		var_dump($get);
		$post = $this->getRequest()->getPost('a');
		//var_dump($post);
		/* echo APPLICATION_PATH;
		echo "<br/>";
		echo  $this->getView()->getScriptPath(); */
		$model = new UserModel();
		//echo $model->selectUser();
		echo json_encode(array('status'=>'123'));
	}
	
	public function showAction(){
		var_dump($_SERVER['REQUEST_METHOD']);
		//$this->getResponse()->setRedirect('http://www.baidu.com');//重定向
		if($this->getRequest()->isGet()){
			echo 'GET';
		}else if($this->getRequest()->isPost()){
			echo 'POST';
		}else if($this->getRequest()->isPut()){
			echo 'PUT';
		}else if($this->getRequest()->isDelete()){
			echo 'delete';
		}
	}
	
}